Refactor protobuf flag abstraction layer to custom flag targets#28787
Draft
copybara-service[bot] wants to merge 1 commit into
Draft
Refactor protobuf flag abstraction layer to custom flag targets#28787copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
copybara-service
Bot
force-pushed
the
test_952990495
branch
6 times, most recently
from
July 24, 2026 14:37
7e6ef66 to
b078688
Compare
Instead of having rules depend on both native and Starlark versions of flags and reconciling them inside the rule implementation, this change moves the resolution logic into custom flag targets (`compat_bool_flag` and `compat_string_list_flag`) defined in `third_party/protobuf/bazel/private/compat_flag.bzl`. Key details: - `compat_bool_flag`: Instantiates a `string_flag` with a "default" sentinel value to detect explicit Starlark flag settings vs. fallback to native `config_setting` matches or default values, providing a boolean `BuildSettingInfo`. - `compat_string_list_flag`: Defines a string-list build setting that reconciles explicit Starlark build settings with `ctx.fragments.proto` and default values. - Updates rule implementations under `third_party/protobuf/bazel/private/` to consume custom flag targets directly. - Replaces `native_bool_flag.bzl` with `compat_flag.bzl`. PiperOrigin-RevId: 952990495
copybara-service
Bot
force-pushed
the
test_952990495
branch
from
July 24, 2026 16:02
b078688 to
b83ceee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor protobuf flag abstraction layer to custom flag targets
Instead of having rules depend on both native and Starlark versions of flags and reconciling them inside the rule implementation, this change moves the resolution logic into custom flag targets (
compat_bool_flagandcompat_string_list_flag) defined inthird_party/protobuf/bazel/private/compat_flag.bzl.Key details:
compat_bool_flag: Instantiates astring_flagwith a "default" sentinel value to detect explicit Starlark flag settings vs. fallback to nativeconfig_settingmatches or default values, providing a booleanBuildSettingInfo.compat_string_list_flag: Defines a string-list build setting that reconciles explicit Starlark build settings withctx.fragments.protoand default values.third_party/protobuf/bazel/private/to consume custom flag targets directly.native_bool_flag.bzlwithcompat_flag.bzl.